﻿<%@ Page Title="" Language="C#" MasterPageFile="../Shared/Theme.Master" Inherits="System.Web.Mvc.ViewPage<Fashion.ViewModels.CartViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Shopping Cart
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="Container">
        <div class="ShoppingCart">        
            <h1>Shopping Cart</h1>
        </div>
    </div>
    <% if ((int)Session["totalItems"] == 0)
       { %>
        <p>No item in your Cart now.</p>
    <% }
       else
       { %>    

        <div>
		    <table class="Grid" cellspacing="0" cellpadding="4" border="0" id="Cart" style="border-collapse:collapse;">
			    <tbody>
                    <tr class="Header">
				        <th align="left" scope="col">REMOVE ITEM</th><th align="left" scope="col">&nbsp;</th><th align="left" style="width:200px" scope="col">ITEM</th><th align="left" style="width:50px" scope="col">COLOR</th><th align="left" style="width:50px" scope="col">SIZE</th><th align="left"  style="width:100px" scope="col">QUANTITY</th><th align="left" scope="col"  style="width:100px">PRICE</th><th align="right" scope="col">TOTAL</th>
                        <% foreach (var product in Model.Products)
                       { %>
                    </tr>
                    <tr class="Row">
				        <td class="RemoveItem">
                            <a href='../ShoppingCart/Remove?pid=<%:product.ProductID%>'><input type="image" name="RemoveLineItem" id="RemoveLineItem" title="Remove this item" src="/Themes/Default/Content/images/RemoveLineItem.png" style="border-width:0px;"/></a>
                        </td>
                        <td>
                            <a href='../<%: product.control %>/Product?pid=<%:product.ProductID%>'>
                            <img src="../../../../Content/<%: product.ImageList %>" width="50" height="30" alt="<%: product.ProductName %>"/>
                            </a>
                            &nbsp;&nbsp;&nbsp;
                        </td>
                        <td>
                            <div>
                                <a href='../<%: product.control %>/Product?pid=<%:product.ProductID%>'><%:product.ProductName%></a>
                            </div>
                            <div class="Description" enableviewstate="false">
                                Item# <%:product.ProductID%><br/>
                            </div>
                        </td>
                         <td>
                           <div class="Description" enableviewstate="false">
                                <%:product.color%><br/>
                            </div>
                        </td>
                         <td>
                           <div class="Description" enableviewstate="false">
                                <%:product.size%><br/>
                            </div>
                        </td>
                        <td>
                            <select id="<%: product.ProductID %>" onchange="return UpdatePrice(this)">
					            <option selected="selected" value="1">1</option>
					            <option value="2">2</option>
					            <option value="3">3</option>
					            <option value="4">4</option>
					            <option value="5">5</option>
					            <option value="6">6</option>
					            <option value="7">7</option>
					            <option value="8">8</option>
					            <option value="9">9</option>
					            <option value="10">10</option>
				            </select>
                            <span id="RangeValidator" style="color:Red;display:none;">* Out of stock</span>
                            <input type="hidden" name="validator" id="validator" value=""/>
                        </td>
                        <td><%:product.Price%></td>
                        <td align="right"><%: product.subTotal %></td>
			        </tr>
                <% } %>
		    </tbody></table>
	    </div>

        <div class="Row Clear">
            <div align="right">
            
                <div>
                    <span id="ErrorMessage" class="Error"></span></div>
            </div>
        </div>

        <div class="Row Clear">
            <div class="Form">
        <div class="Row Clear">
            <div align="right">
            
                <div>
                    <span id="ErrorMessage" class="Error"></span></div>
            </div>
        </div>
        <div class="Row Clear">
            <div class="TotalBox" align="right" style="width: 100%;">
                <div class="Clear Row" style="float: right;">
                    <div class="ShoppingTotalContent">
                        SUBTOTAL
                    </div>
                    <div class="ShoppingTotalContent">
                        <span id="SubTotal" class="subTotal"><%:Model.Total%></span>
                    </div>
                </div>
            
                <div class="Row Clear" style="float:right;">
                    <div class="ShoppingTotalContent">
                        <b>TOTAL</b>
                    </div>
                    <div class="ShoppingTotalContent">
                        <b><span id="CartTotal" class="total"><%:Model.Total%></span></b>
                    </div>
                </div>
            
                <div class="Row Clear" style="width: 100%; white-space: nowrap; text-align: right;">
                    <div class="LeftContent CustomMessage" style="width: 26%; padding-top: 5px; text-align:left;">
                        <span id="lblMsg">*Shipping and Taxes will be added during checkin</span> 
                    </div>            
                </div>
            </div>
            <div class="Clear">
            </div>
            <span id="lblPromoMessage" class="Error"></span>
        </div>
    </div>
    </div>
        <div class="CheckoutBox">
            <a id="ContinueShopping" class="GrayButton" href='../Home/' style="display:inline-block;height:16px;width:140px;">Continue Shopping</a>
            &nbsp;
            <a id="Cart_Checkout" class="Button" onclick="document.forms['paypal'].submit(); return false;" style="display:inline-block;height:16px;width:100px;">Check Out</a>
        </div>
    <% } %>
<form id="paypal" action="<%= ConfigurationManager.AppSettings["PayPalSubmitUrl"] %>" method="post">
    <input type="hidden" name="cmd" value="_xclick" />
    <input type="hidden" name="business" value="<%= ConfigurationManager.AppSettings["PayPalUsername"] %>" />
    <input type="hidden" name="item_name" value="A3 Fashion" />
    <input type="hidden" name="amount" value="<%: Model.Total %>" />
    <input type="hidden" name="return" value="http://localhost:20542/Paypal/Success" />
    <input type="hidden" name="custom" value="Registration started: <%= DateTime.Now.ToString() %>" />
    <!--<input type="submit" value="Check out with Paypal" />-->
    </form>

 

</asp:Content>
